<!DOCTYPE html>
<html lang="en">

    <head>
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Document</title>
    </head>

    <body>

        let bombTimer = setTimeout(() => {
        console.log("BOOM!");
        }, 500);

        if (Math.random() < 0.5) { // 50% chance console.log("Defused."); clearTimeout(bombTimer); } let ticks=0; let
            clock=setInterval(()=> {
            console.log("tick", ticks++);
            if (ticks == 10) {
            clearInterval(clock);
            console.log("stop.");
            }
            }, 200);

    </body>

</html>